package de.bazinga.rotw.base.attacker;

import java.util.Stack;
import java.util.Vector;

public class AttackerList {
	private static Vector<BaseAttacker> attackers = new Vector<BaseAttacker>();
	private static Vector<BaseAttacker> deadAttackers = new Vector<BaseAttacker>();
	private static Stack<BaseAttacker> unusedAttackers = new Stack<BaseAttacker>();
	
	public static synchronized void addAttacker(BaseAttacker att) {
		attackers.add(att);
	}
	
	public static synchronized void removeAttacker(BaseAttacker att) {
		attackers.remove(att);
	}
	
	public static Vector<BaseAttacker> getAttackers() {
		return attackers;
	}
	
	
	public static synchronized void addDeadAttacker(BaseAttacker att) {
		deadAttackers.add(att);
	}
	
	public static synchronized void removeDeadAttacker(BaseAttacker att) {
		deadAttackers.remove(att);
	}
	
	public static Vector<BaseAttacker> getDeadAttackers() {
		return deadAttackers;
	}
	
	
	
	public static synchronized void addUnusedAttacker(BaseAttacker att) {
		att.getBaseAttackerController().setActive(false);
		unusedAttackers.push(att);
	}
	
	public static synchronized BaseAttacker getUnusedAttacker() {
		if(unusedAttackers.size() > 0) {
			return unusedAttackers.pop();
		}
		return new BaseAttacker();
	}
}
